﻿<phone:PhoneApplicationPage xmlns:my1="clr-namespace:EbbinghausWord.Controls"  xmlns:my="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI"  
    x:Class="EbbinghausWord.Pages.ReviewWordPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
                            xmlns:c4f="clr-namespace:Coding4Fun.Phone.Controls;assembly=Coding4Fun.Phone.Controls"
                            FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait"  Orientation="Portrait"
    shell:SystemTray.IsVisible="True" mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480">
    <phone:PhoneApplicationPage.Resources>
        <Style x:Key="splitPanel" TargetType="Border">
            <Setter Property="Height" Value="48"/>
            <Setter Property="Width" Value="50"/>
            <Setter Property="Padding" Value="2"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Background" Value="{StaticResource PhoneAccentBrush}"/>
        </Style>

        <Style x:Key="smallTitleTextBlock" TargetType="TextBlock">
            <Setter Property="FontSize" Value="20"/>
            <Setter Property="TextAlignment" Value="Right"/>
        </Style>

        <Style x:Key="otherTextBlock" TargetType="TextBlock">
            <Setter Property="FontSize" Value="22"/>
            <Setter Property="TextWrapping" Value="Wrap"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
        </Style>

        <Style x:Key="contentTextBlock" TargetType="TextBlock">
            <Setter Property="FontSize" Value="22"/>
            <Setter Property="TextWrapping" Value="Wrap"/>
        </Style>

        <Style x:Key="myTile" TargetType="c4f:Tile">
            <Setter Property="Width" Value="173"/>
            <Setter Property="Height" Value="173"/>
            <Setter Property="Foreground" Value="White"/>
        </Style>
    </phone:PhoneApplicationPage.Resources>

    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:TurnstileTransition Mode="BackwardOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:TurnstileTransition Mode="ForwardOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>

    <!--中文-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="75"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="180"/>
        </Grid.RowDefinitions>

        <!--标题栏-->
        <Grid x:Name="TitlePanel" Grid.Row="0" Margin="12,0,12,0" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="0.5*"/>
                <ColumnDefinition Width="0.25*"/>
                <ColumnDefinition Width="0.25*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <TextBlock x:Name="bookNameTextBlock" Text="CET-4" 
                       Style="{StaticResource PhoneTextNormalStyle}" Grid.ColumnSpan="2" 
                       Margin="0" />
            <TextBlock Name="wordbookTextBlock" Grid.Row="0" Grid.Column="1" 
                       Text="生词/学习" TextAlignment="Center"
                       Style="{StaticResource smallTitleTextBlock}"/>
            <TextBlock Name="remeberLevelTextBlock" Grid.Row="0" Grid.Column="2" 
                       Text="1/20" Style="{StaticResource smallTitleTextBlock}"/>

            <StackPanel x:Name="debugMessagePanel" Orientation="Horizontal" Grid.Row="1" Grid.ColumnSpan="3"
                        Visibility="Collapsed">
                <TextBlock Name="queueCountTextBlock" Style="{StaticResource smallTitleTextBlock}"/>
            </StackPanel>
            <!--<TextBlock Name="totalTextBlock" Grid.Row="0" Grid.Column="1" 
                       Text="1000/4000" Style="{StaticResource smallTitleTextBlock}"/>-->
        </Grid>

        <!--单词内容区域-->
        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,-5">
            <ScrollViewer x:Name="contentScrollViewer" VerticalScrollBarVisibility="Visible">
                <StackPanel Margin="0">
                    <!--英文及发音图标-->
                    <Grid HorizontalAlignment="Center">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition Width="70"/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Name="workTextBlock" TextAlignment="Center"
                                    Style="{StaticResource PhoneTextExtraLargeStyle}" 
                                   Text="{Binding Path=English}"/>

                        <c4f:RoundButton x:Name="voiceButton" Orientation="Horizontal"
                                         Click="voiceButton_Click"
                                         Grid.Column="1" ImageSource="/images\voice-yes.png"/>

                        <MediaElement x:Name="MainME" AutoPlay="False" Volume="1" MediaFailed="MainME_MediaFailed"
                                  MediaOpened="MainME_MediaOpened" MediaEnded="MainME_MediaEnded"></MediaElement>
                    </Grid>

                    <StackPanel Margin="0,10,0,20" >
                        <!--中文面板-->
                        <StackPanel Name="chinesePanel" Visibility="Collapsed" >

                            <!--音标-->
                            <Border Style="{StaticResource splitPanel}">
                                <TextBlock Text="音标" Style="{StaticResource otherTextBlock}"/>
                            </Border>
                            <TextBlock Name="soundmarkTextBlock" Margin="10,0,0,10" 
                                       Style="{StaticResource contentTextBlock}" Text="{Binding Path=Soundmark}" />

                            <!--释义-->
                            <Border Style="{StaticResource splitPanel}">
                                <TextBlock Text="释义" Style="{StaticResource otherTextBlock}"/>
                            </Border>
                            <TextBlock Name="chineseTextBlock" Margin="10,0,0,0"
                                       Style="{StaticResource contentTextBlock}" Text="{Binding Path=Chinese}"/>

                            <!--同义词-->
                            <StackPanel x:Name="synonmyLStackPanel">
                                <Border Style="{StaticResource splitPanel}">
                                    <TextBlock Text="同义" Style="{StaticResource otherTextBlock}"/>
                                </Border>
                                <ListBox x:Name="synonmyListBox" Margin="10,0,0,0" ScrollViewer.VerticalScrollBarVisibility="Disabled">
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Vertical">
                                                <TextBlock Text="{Binding Path=English}" Style="{StaticResource contentTextBlock}" />
                                                <TextBlock Text="{Binding Path=Chinese}" Margin="5,0,0,10" Style="{StaticResource contentTextBlock}" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </StackPanel>

                            <!--词组-->
                            <StackPanel x:Name="wordGroupStackPanel">
                                <Border Style="{StaticResource splitPanel}">
                                    <TextBlock Text="词组" Style="{StaticResource otherTextBlock}"/>
                                </Border>
                                <ListBox x:Name="wordGroupListBox" Margin="10,0,0,0" ScrollViewer.VerticalScrollBarVisibility="Disabled" >
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Vertical">
                                                <TextBlock Text="{Binding Path=English}" Style="{StaticResource contentTextBlock}" />
                                                <TextBlock Text="{Binding Path=Chinese}" Margin="5,0,0,10" Style="{StaticResource contentTextBlock}" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>
                            </StackPanel>

                            <!--例句-->
                            <StackPanel x:Name="sentenceStackPanel">
                                <Border Style="{StaticResource splitPanel}">
                                    <TextBlock Text="例句" Style="{StaticResource otherTextBlock}"/>
                                </Border>
                                <ListBox x:Name="sentenceListBox" Margin="10,0,0,0" ScrollViewer.VerticalScrollBarVisibility="Disabled" >
                                    <ListBox.ItemTemplate>
                                        <DataTemplate>
                                            <StackPanel Orientation="Vertical">
                                                <TextBlock Text="{Binding Path=English}" Style="{StaticResource contentTextBlock}" />
                                                <TextBlock Text="{Binding Path=Chinese}" Margin="5,0,0,10" Style="{StaticResource contentTextBlock}" />
                                            </StackPanel>
                                        </DataTemplate>
                                    </ListBox.ItemTemplate>
                                </ListBox>

                                <my1:PaidAdControl x:Name="padiAdControl" Margin="0,20,0,20" />
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            </ScrollViewer>

            <!--显示中文的按钮-->
            <Grid Name="isKownTextPanel" Margin="0,200,0,100">
                <TextBlock Text="这个单词认识吗？" Style="{StaticResource PhoneTextLargeStyle}"
                           HorizontalAlignment="Center" VerticalAlignment="Center"/>
            </Grid>

            <Grid Height="50" VerticalAlignment="Bottom" Background="{StaticResource PhoneBackgroundBrush}">
                <Grid.OpacityMask>
                    <LinearGradientBrush EndPoint="0.5,1" MappingMode="RelativeToBoundingBox" StartPoint="0.5,0">
                        <GradientStop Color="#00000000" Offset="0"/>
                        <GradientStop Color="#FF000000" Offset="1"/>
                    </LinearGradientBrush>
                </Grid.OpacityMask>
            </Grid>
        </Grid>

        <!--按钮栏-->
        <Grid Name="buttonPanel" Grid.Row="2" Width="374" 
                  toolkit:TiltEffect.IsTiltEnabled="True">

            <!--单词是否认识-->
            <Grid Name="isKownButtonPanel" Visibility="Visible" >
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <c4f:Tile Style="{StaticResource myTile}" Title="不认识" Click="noButton_Click">
                    <Image Source="/images\nav-no.png" Stretch="None" />
                </c4f:Tile>
                <c4f:Tile Style="{StaticResource myTile}" Grid.Column="1" Title="认识" Click="yesButton_Click">
                    <Image Source="/images\nav-yes.png" Stretch="None" />
                </c4f:Tile>
            </Grid>

            <!--单词是否正确-->
            <Grid Name="isRightButtonPanel" Visibility="Collapsed">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <c4f:Tile Style="{StaticResource myTile}" Title="错误" Click="noRightButton_Click">
                    <Image Source="/images\nav-incorrect.png" Stretch="None" />
                </c4f:Tile>

                <c4f:Tile Style="{StaticResource myTile}" Grid.Column="1" Title="正确" Click="rightButton_Click">
                    <Image Source="/images\nav-right.png" Stretch="None" />
                </c4f:Tile>
            </Grid>

            <!--下一个按钮-->
            <Grid Name="nextButtonPanel" Visibility="Collapsed">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <c4f:Tile Style="{StaticResource myTile}" Grid.Column="1" Title="下一个" Click="nextButton_Click">
                    <Image Source="/images\nav-next.png" Stretch="None" />
                </c4f:Tile>
            </Grid>
        </Grid>

        <!--没有需要学习的单词-->
        <Grid Name="nowordPanel" Grid.RowSpan="3" Height="400" Visibility="Collapsed">
            <Grid.RowDefinitions>
                <RowDefinition Height="256"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Image Height="256" Width="256" Source="/Images\congratulation.png"/>
            <TextBlock Grid.Row="1" HorizontalAlignment="Center" Text="无词可学，休息一下" 
                       Style="{StaticResource PhoneTextExtraLargeStyle}"/>
        </Grid>

        <ListBox x:Name="testListBox" Background="Blue" Grid.RowSpan="2" Visibility="Collapsed">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <TextBlock Grid.Column="0" FontSize="28" Text="{Binding Path=English}"/>
                        <TextBlock Grid.Column="1" FontSize="28" Text="{Binding Path=RememberTimes}"/>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton x:Name="removeWordBarIconButton" IconUri="/Images/app-remove.png" Text="加为熟词" Click="CompleteRemeberButton_Click"/>
            <shell:ApplicationBarIconButton x:Name="studyAchievementBarIconButton" IconUri="/Images/achievement.png" Text="学习成果" Click="studyAchievementBarIconButton_Click"/>
            <shell:ApplicationBarIconButton x:Name="scoreBarIconButton" IconUri="/Images/score.png" Text="成绩" Click="scoreBarIconButton_Click"/>
            <shell:ApplicationBarIconButton x:Name="selectBookButton" Text="词库" IconUri="/Images/selectbook.png" Click="selectBookButton_Click"/>
            <!--<shell:ApplicationBarIconButton x:Name="testButton" Text="测试" IconUri="/Images/test.png" Click="testButton_Click"/>-->
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="离线单词发音" Click="voiceClick"/>
                <shell:ApplicationBarMenuItem Text="设置" Click="OptionClick"/>
                <shell:ApplicationBarMenuItem Text="反馈意见" Click="feedbackClick"/>
                <shell:ApplicationBarMenuItem Text="给个好评" Click="rankClick"/>
                <shell:ApplicationBarMenuItem Text="关于" Click="AboutClick"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>